package com.example.day18;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;

/**
 * @author Lenovo
 */
public class BuffeeredStreamDemo01 {
    public static void main(String[] args) throws IOException, java.io.IOException {
        //BufferedWriter(Writer out)
        BufferedWriter bw = new BufferedWriter(new
                FileWriter("myCharStream\\bw.txt"));
        bw.write("hello\r\n");
        bw.write("world\r\n");
        bw.close();
        BufferedReader br = new BufferedReader(new FileReader("myCharStream\\bw.txt"));
        char[] chs = new char[1024];
        int len;
        while ((len = br.read(chs)) != -1) {
            System.out.print(new String(chs, 0, len));
        }

        br.close();
    }
}
